﻿@{
    ViewBag.Title = "部门列表";
    Layout = "~/Views/Shared/_Form.cshtml";
    string v = System.Configuration.ConfigurationManager.AppSettings["version"];

}

@section styles{
    <link href="~/Scripts/ztree/zTreeStyle/zTreeStyle.css?v=@v" rel="stylesheet" />
}

@section scripts
{
    <script src="~/Scripts/ztree/jquery.ztree.all.min.js?v=@v"></script>
    <script src="~/Scripts/page/wike.ztree.js?v=@v"></script>
    <script type="text/javascript">
        function beforeClick(treeId, treeNode) {
            $("#txtParentId").val(treeNode.id);
            $("#IFrameIndex").attr("src", "/WorkFlowInstance/HistoryInstanceView?CategoryId=" + treeNode.id);
        }

        function setSize() {
            var height = $(window).height()-20;


            var iFrameIndex = $("#IFrameIndex");

            var content = $(".content-container");

            content.height(height);
            iFrameIndex.height(height-20);


        }
        var config = {
            id: 'pageTree',
            loadUrl: '@Url.Action("GetTrees")',
            addUrl: '@Url.Action("Add")',
            editUrl: '@Url.Action("Edit")',
            deleteUrl: '@Url.Action("Delete")',
            beforeClick: beforeClick
        };
        var pageTree = new WikeTree(config);
        pageTree.load();
        $("#btnCancel").click(function () {
            var zTree = $.fn.zTree.getZTreeObj(config.id);
            zTree.cancelSelectedNode();
            $("#txtParentId").val("");
        });

        setSize();
    </script>
}
<table style="height: 95%" class="table-bordered">
    <colgroup>
        <col style="width: 20%" />
        <col style="width: 80%" />
    </colgroup>
    <tr>
        <td style="vertical-align: top; padding: 5px;">
            
            <input id="txtParentId" type="hidden" />
            <ul id="pageTree" class="ztree">
                <li>页面加载中......</li>
            </ul>
        </td>

        <td style="vertical-align: top; padding: 5px;">
            <iframe id="IFrameIndex" src="" scrolling="auto" frameborder="0" width="100%"></iframe>
        </td>

    </tr>
</table>
